package com.szxy.frontend.search.controller;

import com.szxy.frontend.search.service.SolrService;
import com.szxy.utils.Result;
import com.szxy.utils.SolrDocument;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Auther:zwer
 * @Date:2019/9/11 17:17
 * @Description:com.szxy.frontend.search
 * @Version:1.0
 **/
@RestController
@RequestMapping("/search")
public class SolrController {

    @Autowired
    private SolrService solrService;

    @RequestMapping("/importAll")
    public Result importAll(){
        return this.solrService.importAll();
    }

    @RequestMapping("/list")
    public List<SolrDocument> selectQueryByq(String q,
                                             @RequestParam(defaultValue = "1") Long page,
                                             @RequestParam(defaultValue = "10") Integer pageSize){
        return this.solrService.selectQueryByq(q,page,pageSize);
    }


}
